from django.db import models

# Create your models here.
class Session_info(models.Model):
    id = models.AutoField(max_length=10,primary_key=True)
    movie_id = models.CharField(max_length=10)
    cinema_id = models.CharField(max_length=10)
    be_time = models.DateTimeField()
    ov_time = models.DateTimeField()
    Location = models.CharField(max_length=20)
    price = models.CharField(max_length=5)
    mov_type = models.CharField(max_length=50)
    class Meta:
        unique_together = (
            ('movie_id','cinema_id','be_time','Location'),     #电影，电影院，开始时间，影厅，联合唯一
        )

class cinema(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=255)
    addr = models.CharField(max_length=255)
    label = models.CharField(max_length=100,null=True)
    tel_phone = models.CharField(max_length=14,null=True)
    photodir = models.TextField(null=True)
    class Meta:
        unique_together = (
            ('name','addr'),                      #电影院名字和地址联合唯一
        )